<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加商品</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/Application/iframe/assets/libs/layuiadmin/layui/css/layui.css"/>
    <link rel="stylesheet" href="/Application/iframe/assets/libs/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/Application/iframe/assets/libs/layuiadmin/style/mylay.css" media="all">
    <style type="text/css">
        html {background: #fff;padding-top: 20px;}
    </style>
</head>
<body>
<div class="layui-form">
    <input type="hidden" name="id" value="{$data.id}">
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">Sku名称:</label>
        <div class="layui-input-block">
            <input name="spec_name" placeholder="请输入名称" class="layui-input"
                 lay-verify="required" required value="{$data.spec_name}"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上级菜单:</label>
        <div class="layui-input-block">
             <!--<div id="authoritiesEditParentSel" class="ew-xmselect-tree"></div>-->
            
             <select name="p_id" lay-filter="m_type">
                <option value="0" >顶级菜单</option>
                <volist name="spec" id="vo">
                    <option value="{$vo.id}" <?php if($data['p_id'] == $vo['id']){ ?> selected <?php }?> >{$vo.spec_name}</option>
                </volist>
            </select>
        </div>
    </div>
    


    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">价格:</label>
        <div class="layui-input-block">
            <input name="price" placeholder="请输入排序号"  class="layui-input"
                  value="{$data.price}" />
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">库存:</label>
        <div class="layui-input-block">
            <input name="stock" placeholder="请输入排序号" value="{$data.stock}"  class="layui-input"
                    />
        </div>
    </div>
    

         
            
     
    
  
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-submit" id="LAY-submit" value="确认">
    </div>
</div>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/Application/iframe/assets/libs/layuiadmin/layui/layui.js"></script>

<script>
 
    

    layui.config({
        base: '/Application/iframe/assets/libs/layuiadmin/'
    }).extend({
        index: 'lib/index'
    }).use(['index', 'form', 'upload'], function(){
        var $ = layui.$
            ,upload = layui.upload
            ,form = layui.form;
        //上传

          form.on('select(a_class)', function(data){
			if(data.value == 1){
				$("#seckill").css("display","block");
				form.render('select');
			}
		});


    })
    $("#LAY-submit").click(function(){
        var arr = new Array();
   
         $("input:checkbox[name='spec_id[]']:checked").each(function(i){
            arr[i] = $(this).val();
        });
        var arrData = arr.join(",");
        $("#spec_id").val(arrData);
        console.log(arrData);

    })
    
   
      //data.field.like = arr.join(",");//将数组合并成字符串
</script>
</body>
</html>